cmake_minimum_required(VERSION 3.4.1)
include_directories(${CMAKE_CURRENT_SOURCE_DIR})

add_library(libavcodec SHARED IMPORTED)
set_target_properties(libavcodec PROPERTIES IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/../../../../../frameworkc/libs/${ANDROID_ABI}/libavcodec.so)
add_library(libavdevice SHARED IMPORTED)
set_target_properties(libavdevice PROPERTIES IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/../../../../../frameworkc/libs/${ANDROID_ABI}/libavdevice.so)
add_library(libavfilter SHARED IMPORTED)
set_target_properties(libavfilter PROPERTIES IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/../../../../../frameworkc/libs/${ANDROID_ABI}/libavfilter.so)
add_library(libavformat SHARED IMPORTED)
set_target_properties(libavformat PROPERTIES IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/../../../../../frameworkc/libs/${ANDROID_ABI}/libavformat.so)
add_library(libavutil SHARED IMPORTED)
set_target_properties(libavutil PROPERTIES IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/../../../../../frameworkc/libs/${ANDROID_ABI}/libavutil.so)
add_library(libpostproc SHARED IMPORTED)
set_target_properties(libpostproc PROPERTIES IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/../../../../../frameworkc/libs/${ANDROID_ABI}/libpostproc.so)
add_library(libswresample SHARED IMPORTED)
set_target_properties(libswresample PROPERTIES IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/../../../../../frameworkc/libs/${ANDROID_ABI}/libswresample.so)
add_library(libswscale SHARED IMPORTED)
set_target_properties(libswscale PROPERTIES IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/../../../../../frameworkc/libs/${ANDROID_ABI}/libswscale.so)

add_library(
        ffmpeg
        SHARED
        ../log.h
        safe_queue.h
        JavaCallHelper.h
        JavaCallHelper.cpp
        native_lib.cpp
)
find_library(
        log-lib
        log
)
target_link_libraries(
        ffmpeg
        libavcodec
        libavdevice
        libavfilter
        libavformat
        libavutil
        libpostproc
        libswresample
        libswscale
        ${log-lib}
        -llog -landroid -lOpenSLES -latomic -lm
)